package com.etc.dao;

import com.etc.entity.Equipment;
import com.etc.entity.EquipmentExample;
import com.etc.entity.EquipmentKey;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;

public interface EquipmentMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table equipment
     *
     * @mbggenerated
     */
    int countByExample(EquipmentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table equipment
     *
     * @mbggenerated
     */
    int deleteByExample(EquipmentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table equipment
     *
     * @mbggenerated
     */
    @Delete({
        "delete from equipment",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(EquipmentKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table equipment
     *
     * @mbggenerated
     */
    @Insert({
        "insert into equipment (id, equipment_name, ",
        "munber, status, ",
        "money, save_date, ",
        "update_date)",
        "values (#{id,jdbcType=INTEGER}, #{equipmentName,jdbcType=VARCHAR}, ",
        "#{munber,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, ",
        "#{money,jdbcType=VARCHAR}, #{saveDate,jdbcType=VARCHAR}, ",
        "#{updateDate,jdbcType=VARCHAR})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=true, resultType=Integer.class)
    int insert(Equipment record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table equipment
     *
     * @mbggenerated
     */
    int insertSelective(Equipment record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table equipment
     *
     * @mbggenerated
     */
    List<Equipment> selectByExample(EquipmentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table equipment
     *
     * @mbggenerated
     */
    @Select({
        "select",
        "id, equipment_name, munber, status, money, save_date, update_date",
        "from equipment",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("BaseResultMap")
    Equipment selectByPrimaryKey(EquipmentKey key);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table equipment
     *
     * @mbggenerated
     */
    int updateByExampleSelective(@Param("record") Equipment record, @Param("example") EquipmentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table equipment
     *
     * @mbggenerated
     */
    int updateByExample(@Param("record") Equipment record, @Param("example") EquipmentExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table equipment
     *
     * @mbggenerated
     */
    int updateByPrimaryKeySelective(Equipment record);

    List<Equipment> findByAll();

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table equipment
     *
     * @mbggenerated
     */
    @Update({
        "update equipment",
        "set equipment_name = #{equipmentName,jdbcType=VARCHAR},",
          "munber = #{munber,jdbcType=VARCHAR},",
          "status = #{status,jdbcType=VARCHAR},",
          "money = #{money,jdbcType=VARCHAR},",
          "save_date = #{saveDate,jdbcType=VARCHAR},",
          "update_date = #{updateDate,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(Equipment record);
}